--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: arquivo; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE arquivo (
    id numeric(16,0) NOT NULL,
    id_servico numeric(16,0) NOT NULL,
    nome character varying(256) NOT NULL,
    descricao character varying(1024) NOT NULL,
    id_usuario numeric(16,0) NOT NULL
);


ALTER TABLE public.arquivo OWNER TO owner_cdbis_d;

--
-- Name: arquivo_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE arquivo_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.arquivo_seq OWNER TO owner_cdbis_d;

--
-- Name: arquivo_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE arquivo_seq OWNED BY arquivo.id;


--
-- Name: arquivo_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('arquivo_seq', 1, false);


--
-- Name: banco; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE banco (
    id numeric(16,0) NOT NULL,
    nome character varying(80) NOT NULL,
    ambiente character varying(2) NOT NULL,
    situacao character(1) NOT NULL,
    id_servico numeric(16,0) NOT NULL,
    observacao character varying(1024) NOT NULL,
    id_usuario numeric(16,0) NOT NULL,
    id_instancia numeric(16,0) NOT NULL
);


ALTER TABLE public.banco OWNER TO owner_cdbis_d;

--
-- Name: banco_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE banco_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.banco_seq OWNER TO owner_cdbis_d;

--
-- Name: banco_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE banco_seq OWNED BY banco.id;


--
-- Name: banco_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('banco_seq', 1, false);


--
-- Name: dominio; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE dominio (
    id numeric(16,0) NOT NULL,
    nome character varying(32) NOT NULL,
    id_usuario numeric(16,0) NOT NULL
);


ALTER TABLE public.dominio OWNER TO owner_cdbis_d;

--
-- Name: fornecedor_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE fornecedor_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.fornecedor_seq OWNER TO owner_cdbis_d;

--
-- Name: fornecedor_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE fornecedor_seq OWNED BY dominio.id;


--
-- Name: fornecedor_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('fornecedor_seq', 1, false);


--
-- Name: instalacao; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE instalacao (
    id numeric(16,0) NOT NULL,
    id_versao numeric(16,0) NOT NULL,
    id_servidor numeric(16,0) NOT NULL,
    id_usuario numeric(16,0) NOT NULL,
    diretorio_binarios character varying(256) NOT NULL
);


ALTER TABLE public.instalacao OWNER TO owner_cdbis_d;

--
-- Name: instalacao_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE instalacao_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.instalacao_seq OWNER TO owner_cdbis_d;

--
-- Name: instalacao_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE instalacao_seq OWNED BY instalacao.id;


--
-- Name: instalacao_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('instalacao_seq', 1, false);


--
-- Name: instancia; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE instancia (
    id numeric(16,0) NOT NULL,
    porta numeric(5,0) NOT NULL,
    id_instalacao numeric(16,0) NOT NULL,
    id_usuario numeric(16,0) NOT NULL,
    diretorio_dados character varying(256) NOT NULL,
    is_padrao boolean NOT NULL
);


ALTER TABLE public.instancia OWNER TO owner_cdbis_d;

--
-- Name: instancia_id_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE instancia_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.instancia_id_seq OWNER TO owner_cdbis_d;

--
-- Name: instancia_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE instancia_id_seq OWNED BY instancia.id;


--
-- Name: instancia_id_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('instancia_id_seq', 1, false);


--
-- Name: servico; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE servico (
    id numeric(16,0) NOT NULL,
    codigo character varying(10) NOT NULL,
    nome character varying(80),
    mnemonico character varying(32) NOT NULL,
    unidade_responsavel character varying(25),
    gestor character varying(127),
    observacao character varying(1024),
    id_usuario numeric(16,0) NOT NULL,
    completo boolean NOT NULL
);


ALTER TABLE public.servico OWNER TO owner_cdbis_d;

--
-- Name: servico_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE servico_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.servico_seq OWNER TO owner_cdbis_d;

--
-- Name: servico_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE servico_seq OWNED BY servico.id;


--
-- Name: servico_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('servico_seq', 1, false);


--
-- Name: servidor; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE servidor (
    id numeric(16,0) NOT NULL,
    ip character varying(15) NOT NULL,
    nome character varying(64) NOT NULL,
    id_usuario numeric(16,0) NOT NULL
);


ALTER TABLE public.servidor OWNER TO owner_cdbis_d;

--
-- Name: servidor_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE servidor_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.servidor_seq OWNER TO owner_cdbis_d;

--
-- Name: servidor_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE servidor_seq OWNED BY servidor.id;


--
-- Name: servidor_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('servidor_seq', 1, false);


--
-- Name: usuario; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE usuario (
    id numeric(16,0) NOT NULL,
    nome character varying(255) NOT NULL,
    login character varying(32) NOT NULL,
    cpf character varying(11) NOT NULL,
    senha character varying(256) NOT NULL,
    escrita boolean NOT NULL,
    ativo boolean NOT NULL
);


ALTER TABLE public.usuario OWNER TO owner_cdbis_d;

--
-- Name: usuario_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE usuario_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usuario_seq OWNER TO owner_cdbis_d;

--
-- Name: usuario_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE usuario_seq OWNED BY usuario.id;


--
-- Name: usuario_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('usuario_seq', 1, false);


--
-- Name: versao; Type: TABLE; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

CREATE TABLE versao (
    id numeric(16,0) NOT NULL,
    numero character varying(10) NOT NULL,
    id_dominio numeric(16,0) NOT NULL,
    id_usuario numeric(16,0) NOT NULL
);


ALTER TABLE public.versao OWNER TO owner_cdbis_d;

--
-- Name: versao_seq; Type: SEQUENCE; Schema: public; Owner: owner_cdbis_d
--

CREATE SEQUENCE versao_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.versao_seq OWNER TO owner_cdbis_d;

--
-- Name: versao_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: owner_cdbis_d
--

ALTER SEQUENCE versao_seq OWNED BY versao.id;


--
-- Name: versao_seq; Type: SEQUENCE SET; Schema: public; Owner: owner_cdbis_d
--

SELECT pg_catalog.setval('versao_seq', 1, false);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE arquivo ALTER COLUMN id SET DEFAULT nextval('arquivo_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE banco ALTER COLUMN id SET DEFAULT nextval('banco_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE dominio ALTER COLUMN id SET DEFAULT nextval('fornecedor_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE instalacao ALTER COLUMN id SET DEFAULT nextval('instalacao_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE instancia ALTER COLUMN id SET DEFAULT nextval('instancia_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE servico ALTER COLUMN id SET DEFAULT nextval('servico_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE servidor ALTER COLUMN id SET DEFAULT nextval('servidor_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE usuario ALTER COLUMN id SET DEFAULT nextval('usuario_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE versao ALTER COLUMN id SET DEFAULT nextval('versao_seq'::regclass);


--
-- Data for Name: arquivo; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY arquivo (id, id_servico, nome, descricao, id_usuario) FROM stdin;
\.


--
-- Data for Name: banco; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY banco (id, nome, ambiente, situacao, id_servico, observacao, id_usuario, id_instancia) FROM stdin;
\.


--
-- Data for Name: dominio; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY dominio (id, nome, id_usuario) FROM stdin;
\.


--
-- Data for Name: instalacao; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY instalacao (id, id_versao, id_servidor, id_usuario, diretorio_binarios) FROM stdin;
\.


--
-- Data for Name: instancia; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY instancia (id, porta, id_instalacao, id_usuario, diretorio_dados, is_padrao) FROM stdin;
\.


--
-- Data for Name: servico; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY servico (id, codigo, nome, mnemonico, unidade_responsavel, gestor, observacao, id_usuario, completo) FROM stdin;
\.


--
-- Data for Name: servidor; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY servidor (id, ip, nome, id_usuario) FROM stdin;
\.


--
-- Data for Name: usuario; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY usuario (id, nome, login, cpf, senha, escrita, ativo) FROM stdin;
\.


--
-- Data for Name: versao; Type: TABLE DATA; Schema: public; Owner: owner_cdbis_d
--

COPY versao (id, numero, id_dominio, id_usuario) FROM stdin;
\.


--
-- Name: arquivo_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY arquivo
    ADD CONSTRAINT arquivo_pk PRIMARY KEY (id);


--
-- Name: banco_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY banco
    ADD CONSTRAINT banco_pk PRIMARY KEY (id);


--
-- Name: dominio_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY dominio
    ADD CONSTRAINT dominio_pk PRIMARY KEY (id);


--
-- Name: instalacao_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY instalacao
    ADD CONSTRAINT instalacao_pk PRIMARY KEY (id);


--
-- Name: instancia_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY instancia
    ADD CONSTRAINT instancia_pk PRIMARY KEY (id);


--
-- Name: servico_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY servico
    ADD CONSTRAINT servico_pk PRIMARY KEY (id);


--
-- Name: servidor_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY servidor
    ADD CONSTRAINT servidor_pk PRIMARY KEY (id);


--
-- Name: usuario_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY usuario
    ADD CONSTRAINT usuario_pk PRIMARY KEY (id);


--
-- Name: versao_pk; Type: CONSTRAINT; Schema: public; Owner: owner_cdbis_d; Tablespace: 
--

ALTER TABLE ONLY versao
    ADD CONSTRAINT versao_pk PRIMARY KEY (id);


--
-- Name: fornecedor_versao_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY versao
    ADD CONSTRAINT fornecedor_versao_fk FOREIGN KEY (id_dominio) REFERENCES dominio(id);


--
-- Name: instalacao_instancia_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY instancia
    ADD CONSTRAINT instalacao_instancia_fk FOREIGN KEY (id_instalacao) REFERENCES instalacao(id);


--
-- Name: instancia_banco_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY banco
    ADD CONSTRAINT instancia_banco_fk FOREIGN KEY (id_instancia) REFERENCES instancia(id);


--
-- Name: servico_arquivo_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY arquivo
    ADD CONSTRAINT servico_arquivo_fk FOREIGN KEY (id_servico) REFERENCES servico(id);


--
-- Name: servico_banco_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY banco
    ADD CONSTRAINT servico_banco_fk FOREIGN KEY (id_servico) REFERENCES servico(id);


--
-- Name: servidor_instalacao_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY instalacao
    ADD CONSTRAINT servidor_instalacao_fk FOREIGN KEY (id_servidor) REFERENCES servidor(id);


--
-- Name: usuario_arquivo_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY arquivo
    ADD CONSTRAINT usuario_arquivo_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_banco_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY banco
    ADD CONSTRAINT usuario_banco_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_fornecedor_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY dominio
    ADD CONSTRAINT usuario_fornecedor_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_instalacao_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY instalacao
    ADD CONSTRAINT usuario_instalacao_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_instancia_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY instancia
    ADD CONSTRAINT usuario_instancia_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_servico_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY servico
    ADD CONSTRAINT usuario_servico_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_servidor_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY servidor
    ADD CONSTRAINT usuario_servidor_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: usuario_versao_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY versao
    ADD CONSTRAINT usuario_versao_fk FOREIGN KEY (id_usuario) REFERENCES usuario(id);


--
-- Name: versao_instalacao_fk; Type: FK CONSTRAINT; Schema: public; Owner: owner_cdbis_d
--

ALTER TABLE ONLY instalacao
    ADD CONSTRAINT versao_instalacao_fk FOREIGN KEY (id_versao) REFERENCES versao(id);


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

